//
//  MovieViewController.m
//  16CY
//
//  Created by dllo on 16/3/11.
//
//

#import "MovieViewController.h"
#import "YingDanCollectionViewCell.h"

@interface MovieViewController ()<UICollectionViewDataSource,UICollectionViewDelegate>
@property (weak, nonatomic) IBOutlet UICollectionView *Collection;

@end

@implementation MovieViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    
    UICollectionViewFlowLayout *flowLayout=[[UICollectionViewFlowLayout alloc] init];
    flowLayout.itemSize=CGSizeMake(WIDTH, HEIGHT-64);
    flowLayout.scrollDirection=UICollectionViewScrollDirectionHorizontal;
    flowLayout.minimumLineSpacing=0;
    
    self.Collection.backgroundColor=[UIColor whiteColor];
    [self.Collection setCollectionViewLayout:flowLayout];
    [self.Collection registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Collection"];
    [self.Collection registerNib:[UINib nibWithNibName:NSStringFromClass([YingDanCollectionViewCell class]) bundle:nil] forCellWithReuseIdentifier:@"YingDanCollectionViewCell"];
    
    
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return 3;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row==0) {
        UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"Collection" forIndexPath:indexPath];
        cell.backgroundColor=[UIColor yellowColor];
        return cell;
    }
    else if(indexPath.row==1){
        UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"Collection" forIndexPath:indexPath];
        cell.backgroundColor=[UIColor redColor];
        return cell;
    }
    else{
        YingDanCollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"YingDanCollectionViewCell" forIndexPath:indexPath];
        cell.backgroundColor=[UIColor cyanColor];
        cell.root=self;
        return cell;
    }
}

-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.translucent = NO;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
